home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / editor / flyerproc.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-22  |  6KB  |  242 lines

  1. /* FlyerProc.rexx V3.5A -- (Batch) Interface Glue for FlyerProc            */
  2. /* By Bob Caron (Grue) ©1995 NewTek Inc.                                   */
  3.  
  4. numeric digits 12
  5.  
  6. call remlib('PROJECT_REXX_PORT')
  7. call remlib('ToasterARexx.port')
  8.  
  9. call addlib('PROJECT_REXX_PORT',0)
  10. call addlib('ToasterARexx.port',0)
  11.  
  12. call set_view(2)
  13.  
  14. call REQ_ERROR("Flyer Proc V3.5A     ---   Process flyer clip(s).")
  15.  
  16. ncmd=0
  17. thisisdone=0
  18. do until thisisdone=1
  19.  
  20.   cmdback=chooseclip()
  21.  
  22.   if (ncmd=0 & cmdback="CANCEL") then call quit
  23.  
  24.   if cmdback~="CANCEL" then do
  25.      ncmd=ncmd+1
  26.      cmd.ncmd=cmdback
  27.      icon.ncmd=iconname
  28.      end
  29.  
  30.   call req_error("So far you have "||ncmd||" clips ready to process.")
  31.   if req_tell("Flyer Proc V3.5A","'Continue' to choose another clip.","'Cancel' to start processing.")=0 then thisisdone=1
  32.  
  33. end
  34.  
  35. call req_error("Note: While clips are being processed you can abort by using Control-C.")
  36.   if req_tell("Still want to continue?","Hit 'Continue' to process clips.","Hit 'Cancel' abort FlyerProc.")=0 then call quit()
  37.  
  38. call req_error("")
  39.  
  40. Switcher(TOWB)
  41.  
  42. do count=1 to ncmd
  43.   address command cmd.count
  44.   icontime=1
  45.   if ncmd=1 then do
  46.      Switcher(TOSW)
  47.      icontime=REQ_FLYERJOG("Choose frame for icon.",icon.ncmd,1)
  48.      if icontime="CANCEL" then icontime=1
  49.      icontime=icontime*2
  50.      end
  51.   call makeicon(icon.count,icontime)
  52. end
  53.  
  54. Switcher(TOSW)
  55.  
  56. call req_error("All done.")
  57.  
  58. call remlib('PROJECT_REXX_PORT')
  59. call remlib('ToasterARexx.port')
  60.  
  61. exit
  62.  
  63.  
  64.  
  65. quit: PROCEDURE
  66.    call req_error("Canceled.")
  67.    call remlib('ToasterARexx.port')
  68.    call remlib('PROJECT_REXX_PORT')
  69.    exit
  70.  
  71. isclip:
  72. parse arg clipname
  73. if open('CLIP',clipname,'R') then do
  74.    padding=readch('CLIP',12)
  75.    call close ('CLIP')
  76.    if substr(padding,1,4)='CLIP' then return 1
  77.    end
  78. call close ('CLIP')
  79. return 0
  80.  
  81. chooseclip:
  82.  
  83.   /* The following stuff is just to get a filename with a path */
  84.  
  85.   call startfilereq("Source Clip?","","")
  86.  
  87.   exit=1
  88.   do while exit=1
  89.     file=queryfilereq()
  90.     if file=0 then return CANCEL
  91.   if file~="" then exit=0
  92.   address command "c:wait 1"
  93.   end
  94.  
  95.   if lastpos('/',file,length(file)-1)~=0 then do
  96.      filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  97.      path=left(file,(lastpos('/',file,length(file))-1))
  98.      end
  99.   else do
  100.      filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  101.      path=left(file,(lastpos(':',file,length(file))))
  102.      end
  103.  
  104.   address command "c:cd "path
  105.  
  106.   call pragma("D",path)
  107.   path=pragma("D","RAM:")
  108.  
  109.   if right(path,1)=":" then Source=path||filenam
  110.   else Source=path||"/"||filenam
  111.  
  112.   if isclip(source)=0 then do
  113.      call req_tell("Error!","            That isn't a clip!")
  114.      return CANCEL
  115.      end
  116.  
  117.   if fields=-2 then do
  118.     call req_tell("Error!","I can't find that file.")
  119.     return CANCEL
  120.     end
  121.  
  122.   /* end of that requestor */
  123.  
  124.   /* Do that all over again for the destination */
  125.  
  126.   call startfilereq("Save Clip Where?","FB0:","OutClip."||ncmd+1)
  127.  
  128.   exit=1
  129.   do while exit=1
  130.     file=queryfilereq()
  131.     if file=0 then return CANCEL
  132.     if file~="" then exit=0
  133.     address command "c:wait 1"
  134.   end
  135.  
  136.   if exists(file) then
  137.      if req_tell("Ok to overwrite this file?")=0 then return CANCEL
  138.  
  139.   if lastpos('/',file,length(file)-1)~=0 then do
  140.      filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  141.      path=left(file,(lastpos('/',file,length(file))-1))
  142.      end
  143.   else do
  144.      filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  145.      path=left(file,(lastpos(':',file,length(file))))
  146.      end
  147.  
  148.   address command "c:cd "path
  149.  
  150.   call pragma("D",path)
  151.   path=pragma("D","RAM:")
  152.  
  153.   if right(path,1)=":" then dest=path||filenam
  154.   else dest=path||"/"||filenam
  155.  
  156.   /* End of all that stuff */
  157.  
  158.   times=REQ_FLYERJOG("Choose in and out points.",source,2)
  159.  
  160.   if times="CANCEL" then return CANCEL
  161.  
  162.   starttime=(word(times,1)*2)
  163.   endtime=(word(times,2)*2)
  164.  
  165.   call req_error("Note: You can mix most processes.    (Example: slow motion with reverse.)")
  166.  
  167.   done=0
  168.   buttons='0000'
  169.   do while done=0
  170.     slowmo=0;speedup=0;strobe=0;reverse=0
  171.  
  172.     buttons=req_buttons("Choose Clip Process:",buttons,"Speed Up","Slow Motion","Strobe","Reverse")
  173.  
  174.     if buttons="CANCEL" then return CANCEL
  175.  
  176.     if substr(buttons,1,1)="1" then do
  177.        speedup=1; done=1
  178.        end
  179.     if substr(buttons,2,1)="1" then do
  180.        slowmo=1; done=1
  181.        end
  182.     if substr(buttons,3,1)="1" then do
  183.        strobe=1; done=1
  184.        end
  185.     if substr(buttons,4,1)="1" then do
  186.        reverse=1; done=1
  187.        end
  188.  
  189.     if slowmo=1 & speedup=1 then do
  190.        call req_tell("Error!","You can't mix SpeedUp with SlowMo.")
  191.        done=0
  192.        end
  193.  
  194.     if strobe=1 & speedup=1 then do
  195.        call req_tell("Error!","You can't mix SpeedUp with Strobe.")
  196.        done=0
  197.        end
  198.  
  199.     if strobe=1 & slowmo=1 then do
  200.        call req_tell("Error!","You can't mix SlowMo with Strobe.")
  201.        done=0
  202.        end
  203.   end
  204.  
  205.   if speedup=1 then do
  206.      call req_error("Example: A value of 2 will make the clip twice as fast.")
  207.      number=req_number("Enter a Speed for SpeedUp",'2')
  208.      if number="CANCEL" then return CANCEL
  209.      if number<=0 then number=1
  210.      speed="x"||number
  211.      end
  212.   if slowmo=1 then do
  213.      call req_error("Example: A value of 3 will make the clip three times as long.")
  214.      number=req_number("Enter a Speed For SlowMo",3)
  215.      if number="CANCEL" then return CANCEL
  216.      if number<=0 then number=1
  217.      speed="/"||number
  218.      end
  219.   if strobe=1 then do
  220.      call req_error("This is the length of time, in fields, each image is shown.")
  221.      number=req_number("Number of fields to hold:",2)
  222.      if number="CANCEL" then return CANCEL
  223.      if number<=0 then number=1
  224.      speed="s"||number
  225.      call req_error("This is the number of fields to skip. (Strobe rate)")
  226.      number=req_number("Strobe at what field:",2)
  227.      if number="CANCEL" then return CANCEL
  228.      if number<=0 then number=1
  229.      speed=speed||","||number
  230.      end
  231.   if reverse=1 then speed="-"||speed
  232.   if reverse=1 & slowmo=0 & speedup=0 & strobe=0 then speed="-x1"
  233.  
  234.   cmd="C:flyerproc >CON: "||'"'||source||'"'||" "starttime" "endtime" "||'"'||dest||'"'||" "speed""
  235.   iconname=dest
  236.  
  237. return cmd
  238.  
  239.  
  240.  
  241.  
  242.